package com.eco.fanliapp.admin.controller.web;


import com.eco.fanliapp.admin.annotation.SysLogAnnotation;
import com.eco.fanliapp.admin.common.BaseController;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.SyBlacklist;
import com.eco.fanliapp.service.ISyBlacklistService;
import com.eco.fanliapp.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户黑名单表 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2019-09-09
 */
@RestController
@RequestMapping("/web/syBlacklist")
public class SyBlacklistController extends BaseController {

    @Autowired
    private ISyBlacklistService iSyBlacklistService;

    @SysLogAnnotation(value = "添加黑名单",userType = 2)
    @PostMapping(value = "add")
    public ServerResponse add(@RequestBody SyBlacklist syBlacklist){
        return  iSyBlacklistService.addSyBlacklist(syBlacklist);
    }


    @GetMapping(value = "list")
    public ServerResponse list(){
        return  ServerResponse.createBySuccess("查询成功","");
    }

    @SysLogAnnotation(value = "保存黑名单",userType = 2)
    @PostMapping(value = "save")
    public ServerResponse save(@RequestBody SyBlacklist syBlacklist){
        UserVO authentication = getAuthentication();
        return  iSyBlacklistService.saveSyBlacklist(syBlacklist,authentication);
    }

    @SysLogAnnotation(value = "洗白",userType = 2)
    @PostMapping(value = "update")
    public ServerResponse update(@RequestBody SyBlacklist syBlacklist){
        UserVO authentication = getAuthentication();
        return  iSyBlacklistService.updateSyBlacklist(syBlacklist, authentication);
    }


}
